package nccloud.bs.ftm.framect.headafter.rule;

import nc.bs.ftm.pub.util.UFDateUtil;
import nc.vo.bd.rate.util.RateReturnObject;
import nc.vo.ftm.framect.AggFramectHVO;
import nc.itf.scmpub.reference.uap.bd.currency.CurrencyRatePubService;
import nc.vo.pub.BusinessException;
import nc.vo.pub.lang.UFDate;
import nc.vo.pub.lang.UFDouble;
import nc.vo.pubapp.AppContext;
import nccloud.bs.ftm.framect.headafter.rule.AbstractHeadEditRule;

public class CurrencyEditRule extends AbstractHeadEditRule {

	@Override
	public AggFramectHVO afterEdit(AggFramectHVO billvo) throws BusinessException {
		
//		String pk_currtype = billvo.getParentVO().getCurrency();
//		if(pk_currtype == null) {
//			return billvo;
//		}
//		String corigcurrencyid = billvo.getParentVO().getBasecurrency();
//		String pk_org = billvo.getParentVO().getPk_org();
//		String pk_customer = billvo.getParentVO().getPk_customer();
//		UFDate dbilldate = billvo.getParentVO().getSigningdate();
//		UFDate currdate = AppContext.getInstance().getBusiDate();
//		UFDate firstDay = UFDateUtil.getCurrMonthFirstDay(currdate);
//		RateReturnObject rateReturnObject = CurrencyRatePubService.getCurrencyBuyRateByCustAndOrg(pk_org, pk_customer, pk_currtype, corigcurrencyid, firstDay, 0);
//		UFDouble rate = rateReturnObject.getRate();
//		billvo.getParentVO().setRate(rate);
//		
//		String uscurrencyid = "1002Z0100000000001K8";
//		RateReturnObject usrateReturnObject = CurrencyRatePubService.getCurrencyBuyRateByCustAndOrg(pk_org, pk_customer, pk_currtype, uscurrencyid, firstDay, 0);
//		UFDouble usrate = usrateReturnObject.getRate();
//		billvo.getParentVO().setRateofus(usrate);
		return billvo;
	}

	
}